<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>查询所有信息</title>
<link rel="stylesheet" href="css/bootstrap.css" />
</head>
<body>


<!-- 开始判断前三页是否>0,否则的话从第1页开始，同理后三页 -->
<!-- 当前页：npage  总页数：totalpage   -->
<c:forEach var="p" begin="${npage-3>0?(npage-3):1 }" end="${npage+3<totalpage?(npage+3):totalpage }" step="1">
        
        <!--判断是否是当前页 ,让当前页为另一种颜色-->
		<c:if test="${npage==p }">
            <a class="btn btn-success" href="Pagelist.do?page=${p }">第${p}页 </a>
        </c:if>
        <c:if test="${npage!=p }">
            <a class="btn btn-primary" href="Pagelist.do?page=${p }">第${p}页 </a>
        </c:if>
</c:forEach>

	<br>
	<a class="btn btn-danger" href="Pagelist.do?page=1">首页</a>  
	<a class="btn btn-danger" href="Pagelist.do?page=${npage-1 }">上一页</a>  
	<a class="btn btn-danger" href="Pagelist.do?page=1">第一页</a>
	<a class="btn btn-danger" href="Pagelist.do?page=2">第二页</a>
	
	<c:if test="${npage!=3 }">
		<a class="btn btn-danger" href="Pagelist.do?page=3">第三页</a>
	</c:if>
	
	<a class="btn btn-danger" href="Pagelist.do?page=4">第四页</a>
	<a class="btn btn-danger" href="Pagelist.do?page=5">第五页</a>
	<a class="btn btn-danger" href="Pagelist.do?page=${npage+1 }">下一页</a>
	<a class="btn btn-danger" href="Pagelist.do?page=${totalpage }">末页</a>  
	<table class="table table-striped table-bordered table-hover">
		<tr class="danger">
			<td>用户编号</td>
			<td>用户名</td>
			<td>用户密码</td>
			<td>电子邮箱</td>
			<td>用户性别</td>
			<td>用户地址</td>
			<td>兴趣爱好</td>
			<td>添加时间</td>
			<td>操作</td>
		</tr>

		<c:forEach var="u" items="${list}">
			<tr class="success">
				<td class="active">${u.user_id }</td>
				<td class="success">${u.user_nickname}</td>
				<td class="warning">${u.user_password }</td>
				<td class="danger">${u.user_email }</td>
				<td class="success">${u.user_sex}</td>
				<td class="danger">${u.user_address}</td>
				<td class="active">${u.user_hobby }</td>
				<td class="warning">${u.user_addtime}</td>
				<td>
					<a class="btn btn-success" href="add.jsp">添加</</a>
					<a class="btn btn-danger" href="delete.do?id=${u.user_id }">删除</</a>
					<a class="btn btn-primary" href="toUpdate.do?id=${u.user_id }">修改</</a>&nbsp;
				</td>
			</tr>
		</c:forEach>
	</table>

</body>
</html>